package day0811T;

/**
 * @Author:galaxy_yan
 * @Date: 2022/8/14
 * @Time: 10:02
 * @Description
 * 作业标题(1685)
 * 求阶乘和
 */
public class text3T {
    public static void main(String[] args) {
        int n=5;
        int sum=0;
        for (int i = 1; i <= n; i++) {
            sum+=factorial(i);
        }
        System.out.println(sum);
    }
    public static int factorial(int n){
        if(0==n||1==n){
            return 1;
        }
        return n*factorial(n-1);
    }
}
